<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .p1{
            display: inline-block;
        }
        .p1 img{
            display: inline-block;
            width: 60px;
            height: 60px;
        }
        .p2{
            display: inline-block;
            margin: 20px 40px;
        }
        .p3{
            display: inline-block;
        }
    </style>
    <script src="./http.js"></script>

</head>
<body>
    <span></span>
    <div>
        <!-- <p class="p1"></p>
        <p class="p2"></p>
        <p class="p3"></p> -->
    </div>
    <script>
        let div = document.querySelector("div")
        // 将本地存储输入的值添加到span
        document.querySelector("span").textContent = localStorage.getItem("user")
        // 参数
        let obj = {
            keywords:document.querySelector("span").textContent
            // localStorage.getItem("user") 
        }
        
        http.get("https://autumnfish.cn/search",obj,function(res){
            // 对象取值
           let a = res.result.songs
           console.log(a);
           let html = ""
           a.forEach(function(item){
            html+=`
            <p class="p1"><img src="${item.artists[0].img1v1Url}" alt=""></p>
            <p class="p2">${item.name}</p>
            <p class="p3">${item.artists[0].name}</p></br>
            `
           
           })
           div.innerHTML = html
            console.log(res);

        })
    </script>
</body>
</html>